import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkuSalesEstimationHistoryVO, SkuSalesEstimationHistoryForm, SkuSalesEstimationHistoryQuery } from '@/api/oa/skuSalesEstimationHistory/types';

/**
 * 查询销量预估历史列表
 * @param query
 * @returns {*}
 */

export const listSkuSalesEstimationHistory = (query?: SkuSalesEstimationHistoryQuery): AxiosPromise<SkuSalesEstimationHistoryVO[]> => {
  return request({
    url: '/oa/skuSalesEstimationHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询销量预估历史详细
 * @param id
 */
export const getSkuSalesEstimationHistory = (id: string | number): AxiosPromise<SkuSalesEstimationHistoryVO> => {
  return request({
    url: '/oa/skuSalesEstimationHistory/' + id,
    method: 'get'
  });
};

/**
 * 新增销量预估历史
 * @param data
 */
export const addSkuSalesEstimationHistory = (data: SkuSalesEstimationHistoryForm) => {
  return request({
    url: '/oa/skuSalesEstimationHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改销量预估历史
 * @param data
 */
export const updateSkuSalesEstimationHistory = (data: SkuSalesEstimationHistoryForm) => {
  return request({
    url: '/oa/skuSalesEstimationHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除销量预估历史
 * @param id
 */
export const delSkuSalesEstimationHistory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oa/skuSalesEstimationHistory/' + id,
    method: 'delete'
  });
};
